package io.donlon.android.remotecontrol;

import android.content.SharedPreferences;

public class StorageUtils {
    private static final String STORAGE_NAME = "default";

    public static float getFloat(String key, float defaultValue) {
        SharedPreferences sp = BaseApplication.getSharedPreferences(STORAGE_NAME);
        return sp.getFloat(key, defaultValue);
    }

    public static void setFloat(String key, float value) {
        SharedPreferences.Editor editor = BaseApplication.getSharedPreferences(STORAGE_NAME).edit();
        editor.putFloat(key, value);
        editor.apply();
    }

    public static boolean getBoolean(String key, boolean defaultValue) {
        SharedPreferences sp = BaseApplication.getSharedPreferences(STORAGE_NAME);
        return sp.getBoolean(key, defaultValue);
    }

    public static void setBoolean(String key, boolean value) {
        SharedPreferences.Editor editor = BaseApplication.getSharedPreferences(STORAGE_NAME).edit();
        editor.putBoolean(key, value);
        editor.apply();
    }
}
